﻿Class MainWindow 

  Private Function GetCustomersQuery(ByVal Customers_and_OrdersEntities As _23._04.Customers_and_OrdersEntities) As System.Data.Objects.ObjectQuery(Of _23._04.Customers)

    Dim CustomersQuery As System.Data.Objects.ObjectQuery(Of _23._04.Customers) = Customers_and_OrdersEntities.Customers
    'Restituisce un ObjectQuery.
    Return CustomersQuery
  End Function

  Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded

    Dim Customers_and_OrdersEntities As _23._04.Customers_and_OrdersEntities = New _23._04.Customers_and_OrdersEntities()
    'Carica i dati in Customers. Se necessario, è possibile modificare questo codice.
    Dim CustomersViewSource As System.Windows.Data.CollectionViewSource = CType(Me.FindResource("CustomersViewSource"), System.Windows.Data.CollectionViewSource)
    Dim CustomersQuery As System.Data.Objects.ObjectQuery(Of _23._04.Customers) = Me.GetCustomersQuery(Customers_and_OrdersEntities)
    CustomersViewSource.Source = CustomersQuery.Execute(System.Data.Objects.MergeOption.AppendOnly)
  End Sub

End Class
